package com.guazai.project.service.rpcimpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guazai.common.pojo.InterfaceInfo;
import com.guazai.common.rpc.InterfaceInfoRPC;
import com.guazai.project.mapper.InterfaceInfoMapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * @author qiteng
 */
@DubboService
public class InterfaceInfoRPCImpl implements InterfaceInfoRPC {

    @Resource
    InterfaceInfoMapper interfaceInfoMapper;


    @Override
    public InterfaceInfo getByPathAndMethod(String path, String method) {
        if (StringUtils.isAnyBlank(path, method)) {
            return null;
        }
        QueryWrapper<InterfaceInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("path", path);
        queryWrapper.eq("method", method);
        return interfaceInfoMapper.selectOne(queryWrapper);
    }
}
